Sam's Guide to Programming
Guide to programming (Beginners) It has come to my attention that we are in need of more programmers if we want PoL to work, so I decided to dedicate some of my time to teaching you guys how to program a few useful languages Hopefully, by the time I am finished, you will have knowledge of the essentials and basics of programming and can go more into depth until you are a master at coding If you ever need help, feel free to message Sam Dreadrage Will soon make a detailed guide with multiple lessons on C++, Batch, Python, HTML, and more! Stay tuned! :) Should I continue with this or abandon it? Please comment and vote! Continue Abandon Batch (Shell Linux) If you wish to learn programming C++ one day, it is good to begin with a simple language. One simple language is Batch, with CMD (Command Prompt) as the command line. Batch is a Windows only code, much like Visual Basic To run batch, download either notepad++ (used for coding) Or simply user the normal 'notepad' on windows Once you have written your code, save it as "filename".bat .bat indicates that the file is a batch file, and will automatically be opened with Command Prompt. Lesson 1 Batch consists of many different elements, such as Labels (:A, :Label, :abc, etc), variables (set /a var1=, set /p var2=, etc), and as basically all languages, if and else statements (if %var1% 123 then... else...) If there is ever a command you need help with, type the command /? example: set /? or, you can just message me what you need help with :) Let me explain a few commands in batch echo (echo Hi) - prints text example echo What's up? would display What's up? in command prompt Rem (Rem this is a note) - displays a note not shown in the code example Rem Random note would display... nothing Another way to display notes is by using :: in front of the line This is useful if you wish to remove a line from being executed, but wish to keep it for reference or if needed in the future. Fun little code - color ## to change the text or background color of command prompt, you can use the command color ## with the desired colors. the first alphanumeric is the background color, the second is the text (don't bother memorizing these useless numbers and letters, just enter in color /? for the list List of colors: 0 - Black 1 - Blue 2- Green 3- Aqua 4- Red 5- Purple 6- Yellow 7- White 8 - Gray 9 - Light Blue A - Light Green B - Light Aqua C - Light Red D - Light Purple E - Light Yellow F - Bright White example White background, Light Yellow text would be color 7e and so forth Pause (Pause) - asks for user input to continue Using Pause asks for the user to hit any key to continue the code example echo What's up? Pause echo Not much would display What's up? Press any key to continue . . . Then once you pressed any key: Not much Pause is very useful to put at the end of a batch file, because if you do not, the code will exit rigth away for example echo What's up? Pause echo Not Much Right after you press a key to continue, it would exit immediatly because it takes a fraction of a second for echo Not Much to go through revised code echo What's up? Pause echo Not Much pause Cls (cls) - clears the screen You can use cls to clear the text of the screen example echo Hi there! pause cls echo Bye! pause would display Hi there! after user input: the screen would be cleared, and you would just see Bye! Lesson 2 Echo off Echo off is essential to many batch files, mainly for format reasons. Whenever a line is executed, it shows C:\Users\Username> befoe the code, so if you typed echo Hi! it would really show C:\Users\Username> Hi! don't want this? Don't worry, it can be fixed with 2 simple words echo off add this to the beginning of the code to remove all that microsoft junk example: echo Microsoft junk :( pause cls echo I want it gone! pause would display C:\Users\Username> Microsoft junk :( Press any key to continue... [ Cleared page ] C:\Users\Username> I want it gone! Press any key to continue... One simple line can fix this: echo off echo Microsoft junk :( pause cls echo I want it gone! pause would display Microsoft junk :( Press any key to continue... [ Cleared page ] I want it gone! Press any key to continue... Title (title fun title :D) - changes the title of the batch file By default, the title of Command Prompt or a batch file is simply "Command Prompt" If you wish to change this, you can simply change the title of the page by entering in title TitleGoesHere example echo off title Testing title changing color 0f echo My first title change :) pause cls echo It worked! pause